<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*" errorPage="" %>
<html>
    <head>
<title>Forum main page</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
BODY {
 margin-top: 0px; 
 margin-right: 0px; 
 margin-bottom: 0px; 
 margin-left: 0px;
 scrollbar-face-color: #354463;
 scrollbar-highlight-color: #758393; 
 scrollbar-3dlight-color: #9DA8B3; 
 scrollbar-darkshadow-color: #101842; 
 scrollbar-shadow-color: #253d47; 
 scrollbar-arrow-color: #deb500;
 scrollbar-track-color: #b5b5b5; 
 }
td {  
 font-family: verdana, arial, "ms sans serif", sans-serif;  
 font-size: 11px;  
 color: #ffffff; 
 }
.big {  
 font-family: Verdana, Arial, Helvetica, sans-serif; 
 font-size: 11px; color: #101842; 
 font-weight: bold;
 background-color: #758393;
 }
.content { 
 font-family: verdana, arial, "ms sans serif", sans-serif;
 font-size: 11px;
 color: #101842;
 background-color: #B5B5B5;
 padding-right: 5px;
 padding-left: 5px;
 }
.content1{ 
 font-family: verdana, arial, "ms sans serif", sans-serif;
 font-size: 13px;
 color: #101842;
font-weight:bold;
 background-color: #B5B5B5;
 padding-right: 5px;
 padding-left: 5px;
 }
.content1 a:hover{ 
 font-family: verdana, arial, "ms sans serif", sans-serif;
 font-size: 13px;
 color: red;
font-weight:bold;
 background-color: #B5B5B5;
 }
.smallheader {  
 font-family: verdana, arial, "ms sans serif", sans-serif;
 font-size: 10px; 
 padding-right: 5px;
 line-height: 14px;
 color: #e9f2fc;

 }
.button{
 font-family: verdana, arial, "ms sans serif", sans-serif;
 font-size: 15px; 
 padding-right: 5px;
 line-height: 14px;
 color: #101842;
 background-color: #CCCCCC;
border-style:groove;
font-weight:bold;
}
.button a:hover{
text-decoration: none;
 font-family: verdana, arial, "ms sans serif", sans-serif;
 font-size: 15px; 
 line-height: 14px;
 color: #101842;
 background-color: #CCCCCC;
border-style:groove;
font-weight:bold;
}
a:link { color: #ffffff; text-decoration: underline; }
a:visited { color: #333333; text-decoration: underline; }
a:active { color: #000000; }
a:hover { color:#ff0000; font-weight: normal; }  
.info { 
 font-family: verdana, arial, "ms sans serif", sans-serif; 
 font-size: 11px; 
 line-height: 13px;
 padding-left: 5px;
 color: #ffffff;
 background-color: #9DA8B3;
 }
.infohead { 
 font-family: verdana, arial, "ms sans serif", sans-serif; 
 font-size: 10px; 
 line-height: 12px;
 padding-left: 20px;
 color: #e9f2fc;
 background-color: #758393;
 }
input, textarea, select {
 background-color: #CCCCCC;
 border-style: solid;
 border-width: 1px;
 font-family: verdana, arial, sans-serif;
 font-size: 10px;
 color: #333333;
 padding: 0px;
}
.style1 {color: #C1FF64}
-->
</style>
</head>

<body bgcolor="#FEFEFE" text="#101842" link="#FFFFFF" vlink="#333333" alink="#FF0000">
<a name="top"></a>
<table width="800" border="0" cellspacing="1" cellpadding="3" bgcolor="#000000" align="center">
<%
    String query="select * from forumpost";
    Connection db_conn = null;
    Statement statement = null;
    PreparedStatement pstmt;
    ResultSet rs;
    try{
    Class.forName("com.mysql.jdbc.Driver");
    String url= "jdbc:mysql://localhost:3306/db";
    db_conn = DriverManager.getConnection( url,"root", "root" );
    statement = db_conn.createStatement();
    rs=statement.executeQuery(query);
    %>

<tr><td class="button" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="post.jsp">New Post</a></td></tr><br>
 <tr> 

  <td valign="top" bgcolor="#CCCCCC"><b></b> 
   <table width="100%" border="0" cellspacing="2" cellpadding="3">
    <tr>
     <td valign="top"> 
      <table border=0 width="155%" cellspacing="0" cellpadding="1" align="center">
       <tr> 
        <td class="big" width="100%">:: Forum Headings</td>
       </tr>
       <tr valign="top"> 
        <td colspan=2 class="content"> 
            <%
    while (rs.next()) { // parse the results
    %>
    	
            <table width="100%" border="0" cellspacing="2" cellpadding="3">
                    <tr>
     			<td width="75%" align="left" class="content1"> 
			<% String head=rs.getString("heading"); %>
                            <a href="singlepost.jsp?heading=<%= head%>"><%= head%></a>
                        </td>
			<td width="75%" align="right" class="content">
				<% String da=rs.getString("date"); %>
                            <%= da%>
			</td>
			
		</tr>
		<tr>
     			
			<td width="30%" align="left" class="content">
                        <% String autho=rs.getString("author"); %>
                            <%= autho%>
                            &nbsp;  &nbsp; &nbsp; 
                            
                        </td>
			
			
		</tr>
	
	</table>
        
   <%}%>
        <br><br><hr />
	
	<br>
	
	
         </td>
       </tr>
	
      </table>
      
      
      
      
      
     </td>
     	<td valign="top" width="200"> 
     		
     	</td>
    </tr>
	
   </table>
   
  </td>

 </tr>




 
</table>
    
 
   <% db_conn.close();%>
  <%  } catch(SQLException e){
    e.printStackTrace();
    out.println("sql not found");
    out.println(e);
    } catch(ClassNotFoundException e){
    e.printStackTrace();
    out.println(e);
    }
    %>
</body>
</html>
